package adminLoginPack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import InvestmentPojo.contactusPojo;
import Notifications.notificationsDataLoading;

public class ContactUsAction extends Action {
 
 
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
 
       String mappingValue  ="";
       String userName = (String)request.getParameter("userName");
       String userEmail = (String)request.getParameter("userEmail");
       String userId = (String)request.getParameter("userId");
       String password = (String)request.getParameter("password");
       String userComments = (String)request.getParameter("userComments");
       contactusPojo cs = new contactusPojo();
       cs.setContactName(userName);
       cs.setContactComments(userComments);
       cs.setContactEmail(userEmail);
       cs.setContactUserId(userId);
       notificationsDataLoading dataLoading = new notificationsDataLoading();
       boolean flag = dataLoading.setContactUsValues(cs);
       
       System.out.println("userNameuserNameuserNameuserNameuserNameuserName"+userName);
       if(userName.equals("admin") && password.equals("admin")){
    	   mappingValue ="success";
    	   request.setAttribute("UserID", userName);
       }else{
    	   mappingValue ="failure"; 
       }
       request.setAttribute("inserted", flag);
       request.getSession().setAttribute("UserID", userName);
       return mapping.findForward("contactus");
 
    }
 
}


